﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace HomeWork5
{
    class Program
    {
        static void Main(string[] args)
        {
            try
            {
                Product productTest = new Product("apple", 50);
                Product productTest2 = new Product("peach", 60);
                Client clientTest = new Client("Mr.Wang");
                Client clientTest2 = new Client("Mr.Li");
                OrderItem orderItemTest = new OrderItem(productTest, 5);
                OrderItem orderItemTest2 = new OrderItem(productTest2, 5);
                Order orderTest = new Order(1, clientTest);
                Order orderTest2 = new Order(2, clientTest2);
                OrderService orderServiceTest = new OrderService();
                orderTest.AddOrderItem(orderItemTest);
                orderTest2.AddOrderItem(orderItemTest2);
                orderServiceTest.AddOrder(orderTest2);
                orderServiceTest.AddOrder(orderTest);
                
                orderServiceTest.ShowAllOrder();
                orderServiceTest.OrderSort();
                orderServiceTest.ShowAllOrder();
                orderServiceTest.OrderSortByTotalMoney();
                orderServiceTest.ShowAllOrder();
                orderServiceTest.Export();
                orderServiceTest.DeleteOrder(orderTest2);
                orderServiceTest.ShowAllOrder();
                orderServiceTest.Import();
                orderServiceTest.ShowAllOrder();
                orderServiceTest.DeleteOrder(orderTest2);
                orderServiceTest.ShowAllOrder();
                /*orderServiceTest.OrderSort();
                orderServiceTest.OrderSortByClient();
                orderServiceTest.OrderSortByTotalMoney();
                orderServiceTest.DeleteOrder(orderTest);
                orderServiceTest.DeleteOrder(orderTest);
                orderServiceTest.ModifyOrder(orderTest2, orderTest);
                orderServiceTest.ShowAllOrder();
                orderServiceTest.FindByOrderID(1).ForEach(order => order.ToString());
                orderServiceTest.FindByClientName("Li");
                orderServiceTest.FindByProductName("apple");
                */
            }
            catch (OrderException)
            {
                Console.WriteLine("不存在该订单！");
            }
        }
    }
}
